<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <title>专家抽取管理</title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp" %>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
<!-- <div id="divv" style="width:990px;height:16px;background-color:white;position:absolute;top:437px;left:15px;">
</div> -->
<div class="box box-primary" id="more" style="width:110px;height:22px;background-color:#222c32;position:absolute;z-index:9999;left:850px;top:100px;display:none;font-size:12px;border-top-color:#222c32;">
            <div class="box-body home-message" id="moreOp">
            </div>
        </div>
    <section class="content-header">
        <h1>抽取规则设置</h1>
        <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active">药品招标管理</li>
            <li class="active">专家抽取管理</li>
            <li class="active">抽取规则设置</li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class=" form-inline">
                    <div class="form-group form-group-xs">
                	    <label for="txtDrugName">项目名称：</label>
					    <select class="form-control" style="width:220px;" id="projId" name="projId"></select>
                	</div>
                    <div class="form-group form-group-xs">
                        <label for="txtDrugForm">项目状态：</label>
                        <select class="form-control"  id="status" name="status">
                        	<option value="">请选择</option>
                        	<option value="1">启用</option>
                        	<option value="0">停用</option>
                        </select>
                    </div>
                    <button type="button" onclick="gridSerch()" class="btn btn-success btn-sm">查&nbsp;询</button>
                </div>
            </div>
        </div>

        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>

       <!--  <div class=" box btn-default bottongroup">
        </div> -->
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp" %>
    <script type="text/javascript">
    $(function(){
		$("#projId").HNSelect({
            url: "${pageContext.request.contextPath}/selectController/getDicBidCompany.html", data: { ID: '' }, defaultText: "<option value=''>请选择</option>",
        });
	});
    
        $(function () {
            $("#gridlist").jqGrid({
                url: "${ctx}/bidProject/getDataList.html",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                shrinkToFit:true,
                height: 380,
                colNames: ['操作','projId', '项目名称','采购开始日期','采购结束日期','状态'],
                colModel: [
                    { name: 'operate', width: 60, align: 'center' ,sortable: false,
                      	formatter: function (val, opts, rowdata) {
                      		var str ="";
                      		str += "<a href='${ctx}/expertExtractRule/toExpertExtractRuleList.html?projId="+rowdata.projId+"&name="+rowdata.name+"&isDefault=1'  style='background:url(${ctx}/lib/img/icon/icon.png) no-repeat -80px -40px' class='opIcon' title='设置规则'></a>";
                      		return str;
                      	}
  					},
                    { name: 'projId', key:true,hidden:true,width: 40, align: 'center' ,sortable: false},
                    { name: 'name', width: 130, align: 'left' ,sortable: false},
                    { name: 'starttime', width: 100, align: 'center' ,sortable: false},
                    { name: 'endtime', width: 100, align: 'center' ,sortable: false},
                    { name: 'status', width: 60, align: 'center' ,sortable: false,
						formatter : function(val, opts,rowdata) {
							if (val == 1) {
								return "启用";
							} else if (val == 0) {
								return "停用";
							}
					}}
                ],
                rowNum: 0,
                //rowList: [10, 20, 50, 100],
                rownumbers: true,
                //pager: "#gridpage",
                viewrecords: true,
                caption: "采购项目列表",
                jsonReader: {
                    repeatitems: false  
                },
                loadComplete: function (data) { //完成服务器请求后，回调函数
              /*      	var projId = data.form;
                	if(projId!=null && projId!=""){
                 	$("#projId").find("option").each(function(){
                			if($.trim($(this).val()) == $.trim(projId)){
                				var projId = $(this).val();
                				var name = $(this).text();
                				location.href = "${ctx}/bidProject/toDrugqualityspecList.html?projId="+projId+"&name="+name+"";
                    			//$(this).attr("selected",true).parents("#projId").attr("disabled","disabled");
                    			//$("#status").find("option[value='1']").attr("selected",true).parents("#status").attr("disabled","disabled");
                    			return;
                    			
                    		}
                	 });  
                  } */
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        //查询
        function gridSerch() {
        	var projId = $("#projId").val();
        	var status = $("#status").val();
    		$("#gridlist").jqGrid('setGridParam',{  
    	        datatype:'json',
    	        postData:{
    	        		"projId":projId,
    	        		"status":status
    	        		}
    	    }).trigger("reloadGrid"); //重新载入  
    	}
       
      //鼠标移动事件
        function over(id,projId,name){//鼠标移入
    	  	 
        	$("#moreOp").children().remove();
        	var coord=$("#"+id+"d").offset();
        	$("#more").css("top",coord.top-1);
        	$("#more").css("left",coord.left-$("#more").width());
        	$("#more").show();  
        	$("#moreOp").append("<a id='"+id+"w'  href='${ctx}/bidProject/toImportDrugByCatalog.html?projId="+projId+"&name="+name+"' style='color:#fff;float:left;display:block'>按目录添加药品</a>");
        	
        	
        }
        //鼠标移出，隐藏
    	var flag = false;
	    var mouseX=0;
	    var mouseY=0;
        $(document).mousemove(function(e){
			  mouseX=e.pageX;
			  mouseY=e.pageY;
			  var coord=$("#more").offset();
	   		  if((mouseX<coord.left||mouseX>(coord.left+$("#more").width())||mouseY<coord.top||
	   				  mouseY>(coord.top+$("#more").height()))&&(mouseX<(coord.left+$("#more").width())||
	   						  mouseX>(coord.left+$("#more").width()+50)||mouseY<(coord.top+1)||mouseY>(coord.top+24+1))){
	   		  	  $("#more").hide();
	   		  } 
		});
        
    </script>
</body>
</html>